package com.sky.controller.user;

import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author by 孙有泽
 * @Date 2025/3/17 20:54
 * @Description 用户分类管理
 */
@RestController("userCategoryController")
@RequestMapping("/user/category")
@Api(tags = "用户分类管理")
@Slf4j
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    /*
     * @author 孙有泽
     * @date 2025/3/17 20:55
     * @description 查询分类
     */
    @ApiOperation("菜品类型查询")
    @GetMapping("/list")
    public Result<List<Category>> list(Integer type){
        log.info("菜品类型查询");
        List<Category> list=categoryService.categoryByType(type);
        return Result.success(list);
    }
}
